package top.hours48.ddbearapi.controller;


import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import top.hours48.ddbearapi.handler.AdminHandler;
import top.hours48.ddbearapi.handler.RoleHandler;
import top.hours48.ddbearapi.model.PageResult;
import top.hours48.ddbearapi.model.admin.AuthUserMO;
import top.hours48.ddbearapi.model.role.RoleMO;

import java.util.List;

@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/role")
public class RoleController {
    Logger logger = LoggerFactory.getLogger(RoleController.class);

    @Autowired
    private RoleHandler roleHandler;

    @RequestMapping(value = "/listAll", method = RequestMethod.GET)
    public List<RoleMO> listAll(
            HttpServletRequest servletRequest, HttpServletResponse servletResponse) {

        List<RoleMO> roleMOS = roleHandler.queryRoles();
        return roleMOS;
    }
}
